package cn.ruituo.adv2;
import java.util.*;
public class JiHe {
    public static void main(String[] args) {
        //数组 VS 集合
        //有序
        List list=new ArrayList();
        list.add("你好");
        list.add("java");
        list.set(1,"python");//覆盖
        list.add("C#");
        list.add(Math.E);
        list.add(1,"C++");//添加
        System.out.println(list);
        System.out.println(list.size());
        Object obj=list.get(3);
        System.out.println("第四个是："+obj);
        Object obj3=list.remove(3);
        System.out.println(obj3+" 被删除了。。。");

        //循环输出
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i));
        }
        //增强for
        System.out.println("测试是否包含c++");
        boolean f=list.contains("C++");
        System.out.println(f);
    }
}
